import jakarta.servlet.*;

import java.io.IOException;

public class MyFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        Filter.super.init(filterConfig);
        System.out.println("hello filter init...");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("/hello doFilter...");
        filterChain.doFilter(servletRequest,servletResponse);  //这句话要写，要不然不会向下传递
    }

    @Override
    public void destroy() {
        Filter.super.destroy();
        System.out.println("hello filter destroy...");
    }
}
